"""Header_Information
------------------------------------
    File_Name: user
    Author: RR9
    Date: 2024/10/19
    Description: 
------------------------------------
"""

from tortoise.models import Model
from tortoise import fields


class User(Model):
    id = fields.IntField(pk=True)
    userid = fields.IntField(unique=True, index=True,  description="编号")
    username = fields.CharField(max_length=20, description="用户名")
    hashed_password = fields.CharField(max_length=60, description="密码")
    disabled = fields.BooleanField(default=False, description="禁用")

    def __str__(self):
        """打印时"""
        return f"<User: {self.username}>"

    def __repr__(self):
        """调用时"""
        return f"<User(id = {self.id}, username = {self.username})>"
